<div class="modal-header">
    <h3 class="modal-title">添加新用户</h3>
</div>
<div class="modal-body">
    <form role="form" name="form">
        <div class="form-group required {{ (errorClass == 'has-error username') ? errorClass : ''}}">
            <label class="control-label">用户名</label>
            <input type="text" class="form-control" name="username" data-ng-model="username" placeholder="输入用户名" autofocus ng-pattern="restrictNumber"
                ng-class="{'input--error': form.name.$valid == false, 'input': form.name.$valid == true}">
                <span class="chars" ng-class="{'chars--active': form.name.$valid == false, 'chars': form.name.$valid == true}">仅限 [A-Za-z0-9_-]字符</span>
                <span class="help-block" data-ng-show="errorClass == 'has-error username'" data-ng-bind="errorMessage"></span>
        </div>

        <div class="form-group required {{ (errorClass == 'has-error passwd') ? errorClass : ''}}">
            <label class="control-label">密码</label>
            <input type="password" class="form-control" data-ng-model="passwd" placeholder="输入密码">
            <span class="help-block" ng-show="errorClass == 'has-error passwd'" ></span>
        </div>

        <div class="form-group required {{ (errorClass == 'has-error passwdConfirm') ? errorClass : ''}}">
            <label class="control-label">确认密码</label>
            <input type="password" class="form-control" ng-model="passwdConfirm" placeholder="输入密码">
            <span class="help-block chars--active" ng-show="passwdConfirm != passwd" >密码不匹配</span>
        </div>

        <div class="form-group">
            <label>Email</label>
            <input type="text" name="email" class="form-control" data-ng-model="email" placeholder="输入 email" ng-pattern="patternEmail"
                ng-class="{'input--error': form.email.$valid == false, 'input': form.email.$valid == true}">
                <span class="chars" ng-class="{'chars--active': form.email.$valid == false, 'chars': form.email.$valid == true}">请输入有效的电子邮件地址</span>
        </div>

        <div class="form-group">
            <label>名称</label>
            <input type="text" class="form-control" data-ng-model="name" placeholder="输入名称">
        </div>
        <div class="form-group">
            <label>联系方式</label>
            <input type="text" class="form-control" data-ng-model="lianxi" placeholder="输入联系方式">
        </div>
        <div class="form-group">
            <label>角色</label>
            <select data-ng-init="selectRole = 'Administrator'" data-ng-model="selectRole" data-ng-options="y for (x,y) in roles"></select>
            <!--<label data-ng-bind="selectRole"></label>
        <label data-ng-bind="roleArray[selectRole]"></label> -->
        </div>
        
        <div class="row">
            <div class="col-md-12 parent-required">
                <p class="p-required"><sup class="sup-required">*</sup>- 为必填字段</p>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn btn-success btn-flat {{blockButtonsClass}}" ng-disabled="!(form.$valid && (passwdConfirm == passwd) && passwdConfirm && username)" type="button" ng-click="addNewUser()">添加</button>
            <button class="btn btn-default btn-flat" type="button" ng-click="closeModal()">取消</button>
        </div>
    </form>
</div>
